import  com.lucastex.grails.fileuploader.UFile

class Article {

    String title
    String content
 
    String category 
    Teacher editor
    Date createTime = new Date()
    Date lastTime  = new Date() //最后编辑时间
    Teacher owner// 当前编辑人，此对象为null就是可编辑

 
    Integer hit = 0 //
    static hasMany = [ attachments : UFile, shared: Teacher ]



    static mapping = {
       table 'xedu_article'
  
       sort  lastTime : 'desc'
    }

    static constraints = {
        title(size:1..250,blank:false)
        category(size:1..250,blank:false)
        content(size:0..10000,blank:false)
        attachments()
        shared()
    
        editor(nullable: true)
        hit(blank:true)
        owner(nullable: true)
        
    }

    String toString() {
        "${title}"
    } 
}
